import os
from datetime import timedelta
import re

# 服务器启动地质
HOST = '127.0.0.1'
PORT = '8000'
DEBUG = True
DOMAIN = 'http://4izqpc.natappfree.cc'
# 项目目录
BASE = os.path.dirname(os.path.abspath(__file__))

# 数据库
DATABASE = {
    'port': '3306',
    'host': '127.0.0.1',
    'charset': 'utf8',
    'database': 'qfpydb',
    'username': 'root',
    'password': '123456'
}

# sqlalchemy 连接url
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://%s:%s@%s:%s/%s?charset=%s' % (
    DATABASE['username'], DATABASE['password'], DATABASE['host'], DATABASE['port'], DATABASE['database'],
    DATABASE['charset'])

# celer配置
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'

# sqlalchemy配置
SQLALCHEMY_TRACK_MODIFICATIONS = False

SECRET_KEY = '8c4bc9d9ffdb464d8c873265b819337a'

SESSION_COOKIE_NAME = '_c_u_s'
PERMANENT_SESSION_LIFETIME = timedelta(days=3)

# 用户性别设置
GENDER = {
    1: '男',
    2: '女'
}

USER_DEFAULT_POINT = 100
USER_TEMPLATE_MAX_NUMBER = 5

# 公共接口不需要登陆验证的接口
PUBLIC_URL = [
    re.compile('.*?profile'),
    re.compile('.*?makemistribution'),
    re.compile('.*?transfer'),
]

# 上传文件路径
UPLOAD_PATH = os.path.join(BASE,'upload')


# 发送信息频率
SEND_TIME_SPACE = 0.25


PAGE_SIZE = 10
PAGE_LENS = 5


# 二维码超时时间
QCODE_TIME_OUT = 50

# 测试开启线程数量
THREDED = 5

# jwt过期时间
JWT_EXP = timedelta(days=3)

#支付宝回调地址
ALIPAY_NOTIFY_URL = 'http://gbpeh2.natappfree.cc/api/alipay/callback/'#'http://4izqpc.natappfree.cc/api/alipay/callback/'
#支付宝appid
ALIPAY_APPID = '2016101100658595'#'2019070165748296'

ALIPAY_REDICT = 'https://openapi.alipaydev.com/gateway.do'#'https://openapi.alipay.com/gateway.do'#'https://openapi.alipaydev.com/gateway.do'

# 邮箱设置

# 网易云邮箱地址
MAIL_SERVER = 'smtp.163.com' 
# 端口
MAIL_PORT = 25

MAIL_USE_TLS = True

MAIL_USERNAME = 'y2956567008@163.com'

MAIL_PASSWORD = 'aiwoderen521lxk'


# redis结果

REDIS_RESULT = 'redis://localhost:6379/2'